const { defineConfig } = require('@vue/cli-service')
const path = require('path');

module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 8080,
    open: true,
    proxy: {
      // 代理所有以 /rbac 开头的请求到 8081
      '/rbac': {
        target: 'http://localhost:8081',
        changeOrigin: true,
        secure: false,
        logLevel: 'debug'
      },
      // 代理所有以 /auth 开头的请求到 8888
      '/auth': {
        target: 'http://localhost:8888',
        changeOrigin: true,
        secure: false,
        logLevel: 'debug'
      }
    }
  },
  configureWebpack: {
    devtool: 'source-map',
    resolve: {
      alias: {
        '@': path.resolve(__dirname, 'src')
      }
    }
  }
})
